//
//  xsTemplateCollectionViewCell.m
//  digital_robot_demo
//
//  Created by xskj on 2024/8/30.
//

#import "xsTemplateCollectionViewCell.h"
  

@interface xsTemplateCollectionViewCell()

@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UIView *bottomView;
@property (nonatomic,strong) UIImageView *iconImageView;

@end

@implementation xsTemplateCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if(self){
        [self.contentView addSubview:self.bottomView];
//        [self.bottomView addSubview:self.titleLabel];
        [self.bottomView addSubview:self.iconImageView];
        
        [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.bottomView);
        }];
//        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.equalTo(self.bottomView.mas_left).offset(5.0);
//            make.right.equalTo(self.bottomView.mas_right).offset(-5.0);
//            make.centerY.equalTo(self.bottomView);
//        }];
    }
    return self;
}

- (void)setModel:(xsTemplateCollectionViewCellModel *)model
{
    _model = model;
    
    //self.titleLabel.text = model.iconUrlString;
    
    self.iconImageView.image = [UIImage imageNamed:model.iconUrlString];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (UIView *)bottomView {
    if (!_bottomView) {
        _bottomView = [[UIView alloc] init];
        _bottomView.backgroundColor = UIColor.clearColor;//COLOR_VCViewBgcolor;
    }
    return _bottomView;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.backgroundColor = UIColor.clearColor;
//        _titleLabel.font = FontSemibold(17);
        _titleLabel.textColor = UIColor.orangeColor;//COLOR_TextGray9B;
        _titleLabel.numberOfLines = 3;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}



- (UIImageView *)iconImageView{
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] init];
        ////        _imageView.layer.masksToBounds = YES;
        ////        _imageView.layer.cornerRadius  = 2.f;
        ////        _imageView.layer.borderWidth = 1.0f;
        ////        _imageView.layer.borderColor = [HexRGB(0x444444, 1.0f) CGColor];
        ////        [_imageView setTitleColor:HexRGB(0x444444, 1.0f) forState:UIControlStateNormal];
        ////        [_imageView.titleLabel setFont:FontMedium(14.f)];
        ////        [_imageView addTarget:self action:@selector(otherAction) forControlEvents:UIControlEventTouchUpInside];
        //        [_imageView setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        //        [_imageView setImage:[UIImage imageNamed:@"editorFontSizeSelect"] forState:UIControlStateSelected];
        //        _iconimageView.image = [UIImage imageNamed:@"BottomSelectCellViewSelectImage"];
        _iconImageView.backgroundColor = UIColor.clearColor;
        //        _iconimageView.hidden = NO;
    }
    return _iconImageView;
}

@end
